<?php

require_once '../../model/Customer.php';

$customer = new Customer();
$customer_id = (int) $_POST['customer_id'];
$rs = mysql_query("SELECT * FROM customer WHERE customer_id = $customer_id");
$row_detail = mysql_fetch_assoc($rs);
$rs2 = mysql_query("SELECT * FROM report_customer WHERE customer_id = $customer_id");
$row_report = mysql_fetch_assoc($rs2);
?> 
<div class="row-fluid" id="popup_edit_customers">

    <div class="span12 sortable">

        <div class="widget">

            <div class="widget-title">

                <h4><i class="icon-reorder"></i>Khách hàng</h4>

                <span class="tools"><a href="javascript:;" class="icon-chevron-down"></a><a href="javascript:;" class="icon-remove"></a></span>
                <input type="hidden" name="customer_id" id="customer_id" value="<?php echo $customer_id; ?>" />
            </div>

            <div class="widget-body">  

                <div class="alert alert-block alert-success fade in" id="success_customer"  style="display: none">

                    <button type="button" class="close" data-dismiss="alert">×</button>

                    <h4 class="alert-heading">Success!</h4>

                    <p>

                        Chỉnh sửa thông tin khách hàng thành công!

                    </p>

                </div>                    

                <div class="alert alert-block alert-error fade in" id="error_save_customer" style="display: none">

                    <button type="button" class="close" data-dismiss="alert">×</button>

                    <h4 class="alert-heading">Error!</h4>

                    <p>

                        Chưa nhập họ tên và số điện thoại

                    </p>

                </div>

                <div class="alert alert-block alert-warning fade in" id="warning_sodo" style="display: none">

                    <button type="button" class="close" data-dismiss="alert">×</button>

                    <h4 class="alert-heading">Warning!</h4>

                    <p>

                        Thông tin số đo quá ít ! Bạn cần kiểm tra lại.

                    </p>

                </div>

                <div class="control-group">

                    <label class="control-label">Họ tên</label>

                    <div class="controls">

                        <input type="text" class="input-xlarge" name="customer_name" id="customer_name" value="<?php echo $row_detail['customer_name']; ?>"/></div>

                </div>

                <div class="control-group">

                    <label class="control-label">Điện thoại</label>

                    <div class="controls">

                        <input type="text" class="input-medium number" name="phone" id="phone" value="<?php echo $row_detail['phone']; ?>" maxlength="11" />

                    </div>

                </div>

                <div class="control-group">

                    <label class="control-label">Email</label>

                    <div class="controls">

                        <input type="text" class="input-xxlarge email" name="email" id="email" value="<?php echo $row_detail['email']; ?>"/>

                    </div>

                </div>  

                <div class="control-group">

                    <label class="control-label">Địa chỉ</label>

                    <div class="controls">

                        <input type="text" class="input-xxlarge" name="address" id="address" value="<?php echo $row_detail['address']; ?>"/>

                    </div>

                </div>                   
                 <div class="control-group">

                    <label class="control-label">Thông tin thêm</label>

                    <div class="controls">

                        <textarea class="input-xlarge" rows="3" name="information" id="information"><?php echo $row_detail['information']; ?></textarea>

                    </div>

                </div>    
                <div class="accordion in collapse" id="accordion1" style="height: auto;">
                    <div class="accordion-group">
                       <div class="accordion-heading">
                          <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion1" href="#collapse_1">
                          <i class=" icon-plus"></i>
                          Số đo
                          </a>
                       </div>
                       <div id="collapse_1" class="accordion-body collapse in">
                          <div class="accordion-inner">
                              <div class="span12 sortable" style="margin: 0px">          
                                    <?php $rs_sodo = mysql_query("SELECT * FROM sodo WHERE customer_id = $customer_id");
                                    $row_sodo = mysql_fetch_assoc($rs_sodo);
                                    ?>
                                    <div class="widget-body">                     

                                        <div class="span3">

                                            <div class="control-group">

                                                <label class="control-label">Vòng ngực</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_nguc" id="vong_nguc" value="<?php if($row_sodo['vong_nguc']>0) echo $row_sodo['vong_nguc']; ?>" /></div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Vòng eo</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_eo" id="vong_eo" value="<?php if($row_sodo['vong_eo']>0) echo $row_sodo['vong_eo']; ?>" />

                                                </div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Vòng mông</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_mong" id="vong_mong" value="<?php if($row_sodo['vong_mong']>0) echo $row_sodo['vong_mong']; ?>"/>

                                                </div>

                                            </div> 

                                            <div class="control-group">

                                                <label class="control-label">Hạ ngực</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="ha_nguc" id="ha_nguc" value="<?php if($row_sodo['ha_nguc']>0) echo $row_sodo['ha_nguc']; ?>"/></div>

                                            </div>

                                        </div>

                                        <div class="span3">

                                            <div class="control-group">

                                                <label class="control-label">Hạ eo</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="ha_eo" id="ha_eo" value="<?php if($row_sodo['ha_eo']>0) echo $row_sodo['ha_eo']; ?>"/>

                                                </div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Rộng vai</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="rong_vai" id="rong_vai" value="<?php if($row_sodo['rong_vai']>0) echo $row_sodo['rong_vai']; ?>"/>

                                                </div>

                                            </div> 

                                            <div class="control-group">

                                                <label class="control-label">Chiều dài tay áo</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="dai_tay_ao" id="dai_tay_ao" value="<?php if($row_sodo['dai_tay_ao']>0) echo $row_sodo['dai_tay_ao']; ?>"/></div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Dài áo (dài đầm)</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="dai_ao" id="dai_ao" value="<?php if($row_sodo['dai_ao']>0) echo $row_sodo['dai_ao']; ?>"/>

                                                </div>

                                            </div>

                                        </div>

                                        <div class="span3">

                                            <div class="control-group">

                                                <label class="control-label">Vòng cổ</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_co" id="vong_co" value="<?php if($row_sodo['vong_co']>0) echo $row_sodo['vong_co']; ?>"/></div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Vòng nách</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_nach" id="vong_nach" value="<?php if($row_sodo['vong_nach']>0) echo $row_sodo['vong_nach']; ?>"/></div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Bắp tay trên</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="bap_tay_tren" id="bap_tay_tren" value="<?php if($row_sodo['bap_tay_tren']>0) echo $row_sodo['bap_tay_tren']; ?>"/>

                                                </div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Bắp tay dưới</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="bap_tay_duoi" id="bap_tay_duoi" value="<?php if($row_sodo['bap_tay_duoi']>0) echo $row_sodo['bap_tay_duoi']; ?>"/>

                                                </div>

                                            </div>                         

                                        </div>

                                        <div class="span3">

                                            <div class="control-group">

                                                <label class="control-label">Vòng đáy</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_day" id="vong_day" value="<?php if($row_sodo['vong_day']>0) echo $row_sodo['vong_day']; ?>"/></div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Vòng ngực trên</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_nguc_tren" id="vong_nguc_tren" value="<?php if($row_sodo['vong_nguc_tren']>0) echo $row_sodo['vong_nguc_tren']; ?>"/></div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">Vòng ngực dưới</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="vong_nguc_duoi" id="vong_nguc_duoi" value="<?php if($row_sodo['vong_nguc_duoi']>0) echo $row_sodo['vong_nguc_duoi']; ?>"/>

                                                </div>

                                            </div>

                                            <div class="control-group">

                                                <label class="control-label">C.dài quần, váy</label>

                                                <div class="controls">

                                                    <input maxlength="3" type="text" class="input-small number" name="dai_quan" id="dai_quan" value="<?php if($row_sodo['dai_quan']>0) echo $row_sodo['dai_quan']; ?>"/>

                                                </div>

                                            </div>                        

                                        </div>                                    

                                    </div>



                            </div>
                          </div>
                       </div>
                    </div>                    
                 </div>    

                              

                <div class="form-actions" id="action_customer">                    
                    <input type="hidden" name="type" id="type" value="1" />
                    <button type="button" class="btn blue" id="btnSaveCustomerEdit" name="btnSaveCustomerEdit" value=""><i class="icon-ok"></i> Lưu </button>                                                                        

                </div>                    

            </div>

        </div>

    </div>

</div>
<script>
jQuery(document).ready(function() {    
    $('.price').number( true );
    $(".number").format({precision: 0,allow_negative:false,autofix:true}); 
    $(".email").format({type:"email"},function(){        
        alert("Email không hợp lệ!");
    });
  
});
</script>